const config = require('../config')
const mongoose = require('mongoose')
const {ip,database} = config
console.log(config);
mongoose.connect(`mongodb://${ip}/${database}`)
module.exports = function(success,error,close){
    mongoose.connection.on('open',()=>{
        success()
    })
    mongoose.connection.on('error',()=>{
        error()
    })
    mongoose.connection.on('close',()=>{
        close()
    })
}